package com.bqjr.xms.service.impl;

import com.bqjr.xms.modle.ProviderUser;
import com.bqjr.xms.modle.ProviderUserConfig;
import com.bqjr.xms.service.ProviderUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

/**
 * Description: ProviderUserServiceImpl.
 * Created by XHZ on 2017/8/6.
 */
@Component
public class ProviderUserServiceImpl implements ProviderUserService {
    @Autowired
    private ProviderUserConfig providerUserConfig;

    public ProviderUser findOne(Long id){
        ProviderUser user = new ProviderUser();
        user.setId(id);
        user.setUsername("provider-user findOne,port:"+providerUserConfig.getPort());
        user.setAge(0);
        return user;
    }

    public String testCircuitBreaker(int id) throws InterruptedException {
        Thread.sleep(5000L);
        String services = "provider-user testCircuitBreaker,port:"+providerUserConfig.getPort()+",id:"+id;
        System.out.println(services);
        return services;
    }
}
